package top.lingkang.privatespace.config.impl;

import top.lingkang.base.impl.DefaultFinalExceptionHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author lingkang
 * Created by 2022/2/15
 */
public class FinalExceptionHandler extends DefaultFinalExceptionHandler {
    @Override
    public void notLoginException(Exception e, HttpServletRequest request, HttpServletResponse response) {
        // super.notLoginException(e, request, response);
        try {
            String servletPath = request.getServletPath();
            request.getSession().setAttribute("forwardPath",servletPath);
            response.sendRedirect("/login");
        } catch (IOException ioException) {
            ioException.printStackTrace();
        }
    }
}
